package com.leetcode.partition4;

/**
 * @author `RKC`
 * @date 2021/9/26 8:18
 */
public class LC371两整数之和 {

    public static int getSum(int a, int b) {
        while (b != 0) {
            int temp = a ^ b;           //异或运算得到相加的位
            b = (a & b) << 1;           //相与左移得到进位
            a = temp;
        }
        return a;
    }

    public static void main(String[] args) {
        System.out.println(getSum(-2, 3));
    }
}
